<include file="Public:header" />
<script type="text/javascript" src="__ROOT__/js/jquery.min.js"></script>
<script type="text/javascript" src="__ROOT__/js/highcharts.js"></script>


<button type="submit" class="btn" name="back－list" onclick="javascript:location.href='{:U(\'Home/FaultRecords/index\',array(\'type\'=>1))}'">返回设备列表</button>

<div id="container" style="width:auto;height;auto"></div>

<script type="text/javascript">

    $(function () {
        $.get("{:U('Home/FaultRecords/getStatistisc',array('equ_id'=>$equipment_id))}",function(xhr){
            if(0 == xhr.status){
                chart.series[0].setData(xhr.info.data,true);
                console.log(xhr.info);
                var subtitle = {
                            text:xhr.info.equipment_info.number+"("+xhr.info.equipment_info.name+")",
                            style:{
                                color:"#ff0000"
                            }
                        };
                        chart.setTitle(null,subtitle);
            }else{
                alert('暂无数据');
            }
        });

        var chart = new Highcharts.Chart({
            chart: {
                renderTo:'container',
                type: 'line'                         //指定图表的类型，默认是折线图（line）
            },
            title: {
                text: '设备故障信息统计表',
                x: -20 //center
            },
            subtitle: {
                text: '',
                x: -20
            },
            xAxis: {
                // categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
                //     'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
                categories: ['一月', '二月', '三月', '四月', '五月', '六月',
                    '七月', '八月', '九月', '十月', '十一月', '十二月']
            },
            yAxis: {
                title: {
                    text: '故障次数'
                },
                plotLines: [{
                    value: 0,
                    width: 1,
                    color: '#808080'
                }]
            },
            tooltip: {
                valueSuffix: '次'
            },
            legend: {
                layout: 'vertical',
                align: 'right',
                verticalAlign: 'middle',
                borderWidth: 0
            },
            series: [{
                name: '故障设备',
                data: [ ]
            }]
        });
        
    });
</script>

<include file="Public:footer" />

